{
*******************************************************************************
-------------------------------------------------------------------------------
Kliper - next generation multimedia player
Copyright (C) Marcin 'vi4m' Kliks (vi4m@wp.pl)
Copyright (C) Tomasz 'dymsza' Odrobny (dymsza@gmail.com)
-------------------------------------------------------------------------------
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*******************************************************************************
}

unit closeForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, main, utils;

type
  TcloseFormFrm = class(TForm)
    closeInfo: TLabel;
    abortButton: TButton;
    closeTimer: TTimer;
    Label1: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure closeTimerTimer(Sender: TObject);
    procedure abortButtonClick(Sender: TObject);
  private
    counter: word;
    lab: string;
    { Private declarations }
  public
    { Public declarations }
  end;

var
  closeFormFrm: TcloseFormFrm;

implementation

{$R *.dfm}

procedure TcloseFormFrm.FormCreate(Sender: TObject);
begin

  counter := 11;
  closeTimer.Enabled := true;
  lab := translatestr('KTS_GENERIC_SECONDS');
  closeTimerTimer(sender);
end;

procedure TcloseFormFrm.closeTimerTimer(Sender: TObject);
begin
  if counter = 0 then begin
    closeTimer.Enabled := false;
    delphiExitWindows(windows.EWX_SHUTDOWN)
  end
  else
    dec(counter);
  label1.Caption := inttostr(counter) + ' ' + lab;
end;

procedure TcloseFormFrm.abortButtonClick(Sender: TObject);
begin
  closeTimer.Enabled := false;
  close;
end;

end.
